package com.ctaa.ctaa.controller;

import com.ctaa.ctaa.dto.Result;
import com.ctaa.ctaa.pojo.BkkpPojo;
import com.ctaa.ctaa.service.BkkpService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;

/**
 * 记账控制类
 */
@RestController
@RequestMapping("bkkp")
public class BkkpController {

    @Resource
    BkkpService bkkpService;


    /**
     * 消费记账
     *
     * @return
     */
    @PostMapping("bp")
    public Result<Boolean> bk(BkkpPojo bkkpPojo) {
        return bkkpService.bk(bkkpPojo);
    }

    @GetMapping("bkkpList")
    public Result<Map<String, Object>> searchList(String beginTime, String endTime, Integer type,
                                                  Integer userId, Integer limit, Integer offset) {
        return bkkpService.searchList(beginTime, endTime, type, userId, limit, offset);
    }

}
